/**
 * Created by ruiyuan on 15-12-23.
 */

module.exports = function (app) {
    var group = require('../controllers/group-controller');
    var tokenFilter = require('../filters/token-filter');

    app.all('/rest/' + RESTFullServiceVersion + '/group/*', tokenFilter.doCheckToken);

    //创建家庭群组
    app.get('/rest/' + RESTFullServiceVersion + '/group/newFamily/:token/:deviceId', group.createNewFamily);

    app.get('/rest/' + RESTFullServiceVersion + '/group/list/:token/:deviceId', group.getGroupList);

    //群组信息（名称和成员列表及状态）
    app.get('/rest/' + RESTFullServiceVersion + '/group/info/:groupId/:token/:deviceId', group.getGroupInfo);

    //确认加入
    app.post('/rest/' + RESTFullServiceVersion + '/group/confirmToJoin/:token/:deviceId', group.confirmToJoin);

    //移除成员
    //app.post('/rest/' + RESTFullServiceVersion + '/group/removeMember/:token/:deviceId', group.removeMember);

    //退出群组
    app.get('/rest/' + RESTFullServiceVersion + '/group/quitFamily/:groupId/:token/:deviceId', group.quitFamily);

    //发送邀请
    app.post('/rest/' + RESTFullServiceVersion + '/group/invitation/:token/:deviceId', group.inviteUser);

    //记录短信邀请
    app.post('/rest/' + RESTFullServiceVersion + '/group/recordInvite/:token/:deviceId', group.recordInvite);

    app.post('/rest/' + RESTFullServiceVersion + '/group/contacts/:groupId/:token/:deviceId', group.postUserContacts);

    app.get('/rest/' + RESTFullServiceVersion + '/group/inviteInfo/:groupId/:inviter/:token/:deviceId', group.getInviteInfo);
};